package dao //此为与数据库联系最近的层

import (
	"database/sql"
	"new/models"
)

func GetAllOut() (error, []models.Out, int64) {
	var OutDate []models.Out
	var total int64
	err := db.Table("Out").Order("out_id ASC").Count(&total).Find(&OutDate).Error
	return err, OutDate, total
}

func DelOut() error {
	var Out []models.Out
	err := db.Table("Out").Where("out_id = ?", out_id).Delete(&Out).Error
	return err
}
func Updateout(out models.Out) error {
	err := db.Table("Out").Where("out_id = ?", out.out_id).Updates(&out).Error
	return err
}
func AddOut() error {
	err := db.Table("Out").Create(&sql.Out{}).Error
	return err
}
